package com.xcdh.ittools.factory;

import com.alibaba.druid.pool.DruidDataSource;
import com.api.ittools.entity.ToolDatasource;

import javax.sql.DataSource;

public class MysqlDataSourceFactory {

    public static DataSource createDataSource(ToolDatasource ds){
        DruidDataSource dataSource = new DruidDataSource();
        dataSource.setUrl(ds.getDsUrl());
        dataSource.setDriverClassName(ds.getDriverClass());
        dataSource.setUsername(ds.getUsername());
        dataSource.setPassword(ds.getPassword());
        return dataSource ;
    }


}
